CFLAGS = -Wall -fpic -coverage -lm

rngs.o: rngs.h rngs.c
	gcc -c rngs.c -g  $(CFLAGS)

dominion.o: dominion.h dominion.c rngs.o
	gcc -c dominion.c -g  $(CFLAGS)

interface.o: interface.h interface.c
	gcc -c interface.c -g  $(CFLAGS)

randomGenerator.o: randomGenerator.h randomGenerator.c
	gcc -c randomGenerator.c -g $(CFLAGS)

testUtilities.o: testUtilities.h testUtilities.c
	gcc -c testUtilities.c -g $(CFLAGS)

card_councilRoom: card_councilRoom.c dominion.o rngs.o
	gcc -o card_councilRoom -g card_councilRoom.c dominion.o rngs.o $(CFLAGS)

card_smithy: card_smithy.c dominion.o rngs.o
	gcc -o card_smithy -g card_smithy.c dominion.o rngs.o $(CFLAGS)

card_village: card_village.c dominion.o rngs.o
	gcc -o card_village -g  card_village.c dominion.o rngs.o $(CFLAGS)

unit_getWinners: unit_getWinners.c dominion.o rngs.o
	gcc -o unit_getWinners -g unit_getWinners.c dominion.o rngs.o $(CFLAGS)

unit_fullDeckCount:	unit_fullDeckCount.c dominion.o rngs.o
	gcc -o unit_fullDeckCount -g unit_fullDeckCount.c dominion.o rngs.o $(CFLAGS)

unit_isGameOver: unit_isGameOver.c dominion.o rngs.o interface.o
	gcc -o unit_isGameOver -g unit_isGameOver.c dominion.o rngs.o interface.o $(CFLAGS)

unit_shuffle: unit_shuffle.c dominion.o rngs.o
	gcc -o unit_shuffle -g unit_shuffle.c dominion.o rngs.o $(CFLAGS)

test.out: card_councilRoom card_smithy card_village unit_isGameOver unit_fullDeckCount unit_shuffle
	./card_councilRoom >> test.out
	./card_smithy >> test.out
	./card_village >> test.out
	./unit_isGameOver >> test.out
	./unit_fullDeckCount >> test.out
	./unit_shuffle >> test.out
	gcov -b dominion.c >> test.out

systemTest: systemTest.c randomGenerator.o testUtilities.o dominion.o rngs.o interface.o
	gcc -o systemTest -g systemTest.c randomGenerator.o testUtilities.o dominion.o rngs.o interface.o $(CFLAGS)

suite.out: systemTest card_councilRoom card_smithy card_village unit_isGameOver unit_fullDeckCount unit_shuffle
	./card_councilRoom >> suite.out
	./card_smithy >> suite.out
	./card_village >> suite.out
	./unit_isGameOver >> suite.out
	./unit_fullDeckCount >> suite.out
	./unit_shuffle >> suite.out
	./systemTest >> suite.out
	gcov -b dominion.c >> suite.out

clean:
	rm -f *.o card_*.exe unit_*.exe *.out systemTest *.gcov *.gcda *.gcno *.so
	rm -f card_councilRoom card_smithy card_village
	rm -f unit_getWinners unit_fullDeckCount unit_isGameOver unit_shuffle
